<template>
  <view class="page">
    <view class="search-item">
      <u-search
        class="my-10"
        placeholder="请输入就读专科专业名称"
        :show-action="true"
        v-model="name"
        @search="customSearch"
        @custom="customSearch"
      ></u-search>
    </view>

    <view class="content">
      <template v-for="(item, index) in navList" :key="index">
        <view class="item d_flex_b" @click="toStart(item)">
          <view class="word text-26">{{ item.code + " " + item.name + "" }} </view>
          
        </view>
      </template>
    </view>

    <view class="page-btn" v-if="0">
      <view class="btn" @click="">快闪</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // navList:[
      // 	{name:'未学习',num:0,type:4,position:0,data:[],offset:0},
      // 	{name:'错词',num:0,type:5,position:0,data:[],offset:0},
      // 	{name:'已掌握',num:0,type:3,position:0,data:[],offset:0},
      // ],
      navList: [],
      curNav: 0,
      wordData: "",
      name: "",
      specialtyId: "",
      size: 10,
      current: 1,
      total: 0,
    };
  },
  onLoad(options) {
    this.current = 1;
    // console.log("options=", options);
    this.name = options.name || "";
    this.getList(this.name);
  },
  onShow() {},
  onReachBottom() {
    // if (this.navList.length < this.total) {
    //   this.current += 1;
    //   this.getList();
    // }
  },
  methods: {
    changeNav(i) {
      this.curNav = i;
    },
    toStart(item) {
      let curData = this.navList;
      //   uni.showToast({
      //     icon: 'none',
      //     title: `${curData.name}的数量为${curData.num}`
      //   })
      uni.navigateTo({
        url: "/pages/special/selectSpecialDetail" + "?specialtyId=" + item.id,
      });
    },

    customSearch(e) {
      // console.log("customSearch", e);
      this.getList(e);
    },
    getList(name = "") {
      this.$http
        .get1("/client/undergraduate/searchSpecialtys", {
          name: name,
          learnLevel: 1,
          level: 3,
        })
        .then((res) => {
          // console.log(res);
          if (res.code == 200) {
            this.navList = res.data;
          }
        });
    },
  },
};
</script>

<style lang="scss">
page {
  background-color: #f2f3f8;
}
.page {
  padding: 30rpx 30rpx 100rpx;
  box-sizing: border-box;
}

.search-item {
  width: 100%;
  min-height: 110rpx;
  background: #fff;
  box-shadow: 0rpx 4rpx 8rpx 2rpx rgba(42, 65, 152, 0.05);
  border-radius: 20rpx;
  margin-bottom: 20rpx;
  padding: 20rpx 20rpx;
}
.content {
  .item {
    width: 100%;
    min-height: 80rpx;
    background: #ffffff;
    box-shadow: 0rpx 4rpx 8rpx 2rpx rgba(42, 65, 152, 0.05);
    border-radius: 20rpx;
    margin-bottom: 16rpx;
    padding: 1rpx 40rpx;
    .word {
      // width: 360rpx;
      // font-size: 30rpx;
      color: #333333;
    }
  }
}

.page-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 176rpx;
  padding: 30rpx 62rpx;
  box-sizing: border-box;
  background-color: #fff;
  z-index: 10;
  .btn {
    width: 100%;
    height: 90rpx;
    background: #5480f8;
    border-radius: 46rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32rpx;
    font-weight: 500;
    color: #ffffff;
    &.disable {
      background-color: #cad8fc;
    }
  }
}
</style>
